package cn.itcast.p2p20.fragments;


import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.TextView;

import butterknife.ButterKnife;
import butterknife.InjectView;
import cn.itcast.p2p20.R;
import cn.itcast.p2p20.ui.RandomLayout;
import cn.itcast.p2p20.utils.Util;

/**
 * A simple {@link Fragment} subclass.
 */
public class HotProductFragment extends BaseFragment implements View.OnClickListener {

    public static final String tags1[] = {
            "QQ邮箱会员电脑管家软件",
            "微信空间课堂好莱坞腾讯云",
            "快报新闻APP自选股体育APP",
            "视频手机管家浏览器应用宝",
            "LOLCFDNF征途战争雷霆",
            "爱玩逆战火影手游火影OL剑侠",
            "京东理财通企鹅FMQ币全部"};

    public static final String tags2[] = {
            "博鳌亚洲论坛 ",
            "哈佛商业评论 ",
            "财经国家周刊 ",
            "每日经济新闻 ",
            "中国企业家 ",
            "路透中文网 ",
            "国际金融报 ",
            "中国证券网 ",
            "中国经营报 ",
            "经济观察报 ",
            "中国经济网 ",
            "证券市场周刊 ",
            "财新网 ",
            "华夏时报 ",
            "第一财经 ",
            "FT中文网 ",
            "财经网 ",
            "创业家 ",
            "福布斯 ",
            "美通社 ",
            "21世纪经济报道 ",
            "华尔街见闻 ",
            "中国黄金交易网 ",
            "CCTV证券资讯网 ",
            "中国发展研究基金会 ",
            "证券日报 ",
            "中国民族证券 ",
            "新财富杂志 ",
            "环球企业家 ",
            "中国证券报 ",
            "证券时报网 ",
            "易三板 ",
            "中国金融网 ",
            "易三板 ",
            "未央网 ",
            "商学院"};

    @InjectView(R.id.randomlayout1)
    RandomLayout randomlayout1;
    @InjectView(R.id.randomlayout2)
    RandomLayout randomlayout2;

    @Override
    protected void initData() {

        showSuccessStateLayout();

        for (String tag : tags1) {

            View view = Util.createTagView(mContext, tag);
            view.setOnClickListener(this);
            randomlayout1.addView(view);
        }


        for (String tag : tags2) {

            View view = Util.createTagView(mContext, tag);
            view.setOnClickListener(this);
            randomlayout2.addView(view);
        }
    }

    @Override
    protected void initView(View childFragmentView) {

        ButterKnife.inject(this, childFragmentView);
    }

    @Override
    protected String getTitle() {
        return null;
    }

    @Override
    protected int getContentLayoutRes() {
        return R.layout.fragment_hot_product;
    }

    @Override
    public void onClick(View v) {

        String text = ((TextView) v).getText().toString();
        Util.showToast(mContext, text);
    }
}
